#!/usr/bin/env node
const lnk = require("lnk");
const path = require("path");
const fs = require("fs");

const web5Path = path.resolve(__dirname, "../../../web5");
const web5AssetsLink = path.resolve(web5Path,"assets");
const web5Web4AssetsLink = path.resolve(web5Path,"Web4/assets");
const web4AssetsSourcePath = path.resolve(__dirname, "../../../Web4/assets");
// 创建web5目录
fs.exists(web5Path, (exists) => {
  if (!exists) {
    fs.mkdir(web5Path, (err) => {
      if (err) {
        return console.log(err);
      }
      console.log("创建web5目录成功");
    });
  }
});
// 创建web5/assets 符号链接
fs.exists(web5AssetsLink,(exists)=>{
    if (!exists) {
        lnk([web4AssetsSourcePath], web5Path).then(() =>
        console.log("创建assets链接成功")
      );
    }
})
// 创建web5/Web4/assets 符号链接
fs.exists(web5Web4AssetsLink,(exists)=>{
  if (!exists) {
      lnk([web4AssetsSourcePath], path.resolve(web5Path,"Web4")).then(() =>
      console.log("创建web4/assets链接成功")
    );
  }
})